package org.smart4j.framework.controller;

import org.smart4j.framework.annotation.Action;
import org.smart4j.framework.annotation.Controller;
import org.smart4j.framework.annotation.Inject;
import org.smart4j.framework.bean.View;
import org.smart4j.framework.model.Customer;
import org.smart4j.framework.service.CustomerService;

import java.util.List;

/**
 * CustomerServlet
 *
 * @author sc
 * @date 2016-6-16
 */
@Controller
public class CustomerServlet {
    @Inject
    private CustomerService customerService;

    @Action("get:/customer")
    public Object getCustomer() {
        List<Customer> customerList = customerService.getCustomerList();
        View view = new View("customer.jsp");
        view.addModel("customerList", customerList);
        return view;

        /*Data data = new Data(customerList);
        return data;*/
    }
}
